package nl.hu.modellingengine.grid.client.view;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;

public class GridViewWebImpl implements GridView {
	
	@Override
	public Widget asWidget() {
		return RootPanel.get().asWidget();
	}

	@Override
	public void initElement(String elementId) {
		RootPanel e = RootPanel.get(elementId);
		Widget w = e.asWidget();
		GWT.log(elementId);
		if(w instanceof Image){
			Image img = (Image) w;
			img.addClickHandler(new ClickHandler(){

				@Override
				public void onClick(ClickEvent event) {
					Window.alert("Change Properties");
				}
			});
		}

	}

}